/*
 * @Author: Lizhenyu
 * @Date: 2021-07-23 15:01:43
 * @FilePath: \usp-osm-frondend\src\api\order.js
 */
import { service } from '@/utils/request'

const api = {
  masterOrderList: '/admin/order/order/pageList',
  masterOrderDetail: '/admin/order/order',
  childOrderList: '/admin/order/subOrder/pageList',
  childOrderDetail: '/admin/order/subOrder',
  deliveryOrderList: '/admin/order/orderDispatch/pageList',
  deliveryOrderDetail: '/admin/order/orderDispatch',
  logisticsDetail: '/admin/order/orderDispatch/getDeliveryLogistics',
  logisticsInfo: '/admin/order/return/update-logistics',
  // 换货单
  exchangeList: '/admin/order/swap/pageList',
  exchangeDetail: '/admin/order/swap/selectDetail',
  exchangeRquest: '/admin/order/swap/approval',
  receivingInfo: '/admin/order/orderReturnItemsReceipt/selectList',
  operationImages: '/admin/order/orderOperationimages/selectList',
  checkRemark: '/admin/order/orderOperationAuditRecord/selectList',
  addReturnInfo: '/admin/order/return/update-logistics',
  // 洗车订单
  washOrderList: '/admin/order/wash/list',
  serviceOrderList: '/admin/order/work/list',
  serviceOrderDetail: '/admin/order/work/detail',
  // 保存退款单
  addRefundOrder: '/admin/order/refund/save',
  // 开票详情
  invoiceDetail: '/admin/order/billing/detail'
}

export function getMasterList (data) {
  return service({
    url: api.masterOrderList,
    method: 'post',
    data
  })
}

export function getMasterDetail (id) {
  return service({
    url: api.masterOrderDetail + `/${id}`,
    method: 'get'
  })
}

export function getChildList (data) {
  return service({
    url: api.childOrderList,
    method: 'post',
    data
  })
}

export function getChildDetail (id) {
  return service({
    url: api.childOrderDetail + `/${id}`,
    method: 'get'
  })
}

export function getDeliveryList (data) {
  return service({
    url: api.deliveryOrderList,
    method: 'post',
    data
  })
}

export function getDeveryOrderDetail (id) {
  return service({
    url: api.deliveryOrderDetail + `/${id}`,
    method: 'get'
  })
}

export function getDeveryLogistics (id) {
  return service({
    url: api.logisticsDetail + `/${id}`,
    method: 'get'
  })
}

export function addLogisticsInfo (data) {
  return service({
    url: api.logisticsInfo,
    method: 'post',
    data
  })
}

// 换货单
export function getExchangeList (data) {
  return service({
    url: api.exchangeList,
    method: 'post',
    data
  })
}

export function getExchangeDetail (data) {
  return service({
    url: api.exchangeDetail,
    method: 'post',
    data
  })
}

export function approvalExchange (data) {
  return service({
    url: api.exchangeRquest,
    method: 'post',
    data
  })
}

export function getReceivingInfo (data) {
  return service({
    url: api.receivingInfo,
    method: 'post',
    data
  })
}

export function checkRemark (data) {
  return service({
    url: api.checkRemark,
    method: 'post',
    data
  })
}

export function operationExchangeImages (data) {
  return service({
    url: api.operationImages,
    method: 'post',
    data
  })
}

export function addReturnInfo (data) {
  return service({
    url: api.addReturnInfo,
    method: 'post',
    data
  })
}

export function getCarWashOrderList (data) {
  return service({
    url: api.washOrderList,
    method: 'post',
    data
  })
}

export function getServiceOrderList (data) {
  return service({
    url: api.serviceOrderList,
    method: 'post',
    data
  })
}

export function getServiceOrderDetail (workNo) {
  return service({
    url: api.serviceOrderDetail + `/${workNo}`,
    method: 'get'
  })
}

export function saveRefundOrder (data) {
  return service({
    url: api.addRefundOrder,
    method: 'post',
    data
  })
}

export function getInvoiceDetail (id) {
  return service({
    url: api.invoiceDetail + `/${id}`,
    method: 'get'
  })
}
